# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  before_filter :find_cart
    
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => 'f9f10c1e326618742533f8adf1115800'
  include AuthenticatedSystem
  
  private
   
  def find_cart
    cart_data = (session[:cart_data] ||= {:product_ids => [], :meal_ids => []})
    @cart = Cart.new(cart_data)
  end
end
